package com.dragon.common.annotation;

import com.dragon.common.enums.DesensitizedType;
import com.dragon.common.json.serializer.SensitiveDefaultJsonSerializer;
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 数据脱敏注解
 *
 * <p>common模块默认数据脱敏</p>
 * <p>多模块项目建议每个模块独自用 Sensitive注解，并实现每个模块的 SensitiveDefaultJsonSerializer</p>
 * @author dragon
 * @version 1.0
 * @date 2024/9/30 15:04
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@JsonSerialize(using = SensitiveDefaultJsonSerializer.class)
public @interface Sensitive {

    DesensitizedType desensitizedType();

}
